<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
 <jsp:useBean id="dbconn" class="bean.DBConnectionManager"></jsp:useBean>
   <%
 /* String stuno=new String(request.getParameter("stuno").getBytes("iso-8859-1"),"utf-8");
  String stuname=new String(request.getParameter("stuname").getBytes("iso-8859-1"),"utf-8");
  String stusex=new String(request.getParameter("stusex").getBytes("iso-8859-1"),"utf-8");
  String stuage=new String(request.getParameter("stuage").getBytes("iso-8859-1"),"utf-8");
  String stuweight=new String(request.getParameter("stuweight").getBytes("iso-8859-1"),"utf-8");
  */
  String id=request.getParameter("id");
  byte b[]=id.getBytes("iso-8859-1");
  id=new String(b,"utf-8");
  
   String stuname=request.getParameter("stuname");
   byte b1[]=stuname.getBytes("iso-8859-1");
   stuname=new String(b1,"utf-8");
   
   String stusex=request.getParameter("stusex");
   byte b2[]=stusex.getBytes("iso-8859-1");
   stusex=new String(b2,"utf-8");
   
   String stuage=request.getParameter("stuage");
   byte b3[]=stuage.getBytes("iso-8859-1");
   stuage=new String(b3,"utf-8");
  
   
  Connection con=null;
  Statement stmt=null;
  
  if(null==id){
	  response.sendRedirect("http://localhost:8080/studentManage/updatestudent.jsp");
  }
  else
  {
	  try{
		      
   
    //DBConnectionManager dbconn=new DBConnectionManager();
   			con=dbconn.getConnection();
		    stmt=con.createStatement();
		    String sql="update t_student set stuname='"+stuname+"',stusex='"+stusex+"',stuage='"+stuage+"' where stuno='"+id+"'";
		    stmt.executeUpdate(sql);
		   
		   
	      }
	  catch(Exception e){
		  e.printStackTrace();
	  }
	  finally{
		  stmt.close();
		  con.close();
	  }
  }
 %>
 <center>
     <h2>修改学生信息</h2>
     <p>该学生记录已经被修改！</p>
     <form action="lookStudent.jsp" method="post">
       <input type="submit" value="返回">
     </form>
   
   </center>
</body>
</html>